"""
解题思路：
    （1）暴力破解（两层循环遍历）
    （2）哈希表求解
"""


# 哈希表求解
class Solution(object):
    def twoSum(self, nums, target):
        """
        :type nums: List[int]
        :type target: int
        :rtype: List[int]
        """
        hash = {}
        for i in range(len(nums)):
            if (target - nums[i]) in hash:
                return [i,hash[target - nums[i]]]
            hash[nums[i]] = i
        return []